//
//  MessageModel.swift
//  Chatup
//
//  Created by iron man on 2023/12/10.
//

import Foundation

enum MessageType: Int {
    case text = 0
    case assetsImage = 1
    case netWorkImage = 2
    case file = 3
    init?(rawValue: Int) {
        if rawValue == 0 {
            self = .text
        } else if(rawValue == 1){
            self = .assetsImage
        }else if(rawValue == 2){
            self = .netWorkImage
        }else {
            self = .file
        }
    }
}

enum FeaturesType {
    case talk
    case drawImage
    case link
    case emojy
    case document
    case recognizeImage
    case translate
}


struct MessageModel : Identifiable, Hashable{
    var id: UUID
    let isUser: Bool
    let robotIcon: String
    let message: String
    let messageType: MessageType
    let messageFeaturesType: FeaturesType
    let isFinish: Bool
    let isStart: Bool
    let isOutputResponse: Bool?
    let context: String?
    let roleId: String?
    init(isUser: Bool, messageType: MessageType, robotIcon: String, message: String, isFinish: Bool, isStart: Bool, isOutputResponse: Bool? = false, context: String? = nil,feature: FeaturesType = .talk, roleId :String? = "0") {
        self.isUser = isUser
        self.robotIcon = robotIcon
        self.message = message
        self.isFinish = isFinish
        self.isStart = isStart
        self.isOutputResponse = isOutputResponse
        self.messageType = messageType
        self.context = context
        self.messageFeaturesType = feature
        self.roleId = roleId
        self.id = UUID()
    }
    
    func hash(into hasher: inout Hasher) {
            hasher.combine(id)
    }
}


struct TempModel {
    let name: String
    let id: Int
    let icon: String
    let desc: String
    init(name: String, id: Int, icon: String, des: String) {
        self.name = name
        self.id = id
        self.icon = icon
        self.desc = des
    }
}
